<template>
	<view class="home">
		<view class="navam">
			<u-icon name="arrow-left" color="#222222" size="26" @click="ssdfg"></u-icon>
		</view>
		<view class="devitem">
			<view class="devitem_flx" v-for="(i,index) in dataList" :key="index" @click="devitFn(i)">
				<image class="imgim" src="/static/xcel.png" mode=""></image>
				<view class="yuan">
					{{i.groupName}}
				</view>
			</view>
		</view>
		<u-overlay :show="showIF" @click="showIF = false" :opacity="0.8">
			<view class="warp">
				<view class="warp_box">
					<view class="rect_a" @tap="rengTab">
						人工测报雨量 
					</view>
					<view class="rect_b" @tap="zijTab">
						自计测报雨量 
					</view>
				</view>
			</view>
		</u-overlay>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showIF: false,
				dataList: [],
				stype: '',
				rfsgId:0
			}
		},
		onLoad(option) {
			this.stype = option.stype
		},
		onShow() {
			this.upCallback()
		},
		methods: {
			ssdfg() {
				uni.navigateBack({
					delta: 1
				});
			},
			// 人工
			rengTab() {
				uni.navigateTo({
					url: '/pages/index/manualForecastingList?rfsgId=' + this.rfsgId+ '&resstpeID=' + 1
				});
			},
			// 自计测报
			zijTab() {
				uni.navigateTo({
					url: '/pages/index/measureAndReportByList?rfsgId=' + this.rfsgId + '&resstpeID=' + 0
				});
			},
			// 降雨量
			devitFn(i) {
				console.log('i',i);
				if (this.stype == '年度') {
					uni.navigateTo({
						url: '/pages/index/districtList?id=' + i.id + '&name=' + i.groupName
					});
				}
				if (this.stype == '每日') {
					this.rfsgId = i.id
					this.showIF = true
				}
			},
			upCallback() {
				uni.$u.http.get('/api/device/device/getRainFallStationGroupList').then(res => {
					if (res.code == 200) {
						console.log(res);
						this.dataList = res.rows
					} else {
						uni.showToast({
							title: '暂无数据',
							duration: 1500

						});
					}
				}).catch(err => {
					console.log('err', err);
					//  请求失败,隐藏加载状态
					this.mescroll.endErr()
				})
			},
			// 电量
			electricFn(data) {
				let nub = (data - 8) / (12 - 8) * 100
				return nub.toFixed(0)
			},
		}
	}
</script>
<style scoped lang="scss">
	.home {
		.navam {
			margin: 80rpx 30rpx 0rpx 30rpx;
		}

		.devitem {
			padding: 30rpx;
			border-radius: 30rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			flex-wrap: wrap;

			.devitem_flx {
				width: 300rpx;
				margin: 10rpx 0;
				padding: 20rpx;
				border-radius: 30rpx;
				background-color: rgba(255, 255, 255, 0.9);

				.imgim {
					width: 60rpx;
					height: 60rpx;
					margin-right: 20rpx;
				}

				.yuan {
					color: #000;
					font-size: 45rpx;
				}
			}

		}
	}

	// 弹窗
	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
		font-size: 60rpx;
		.warp_box {
			.rect_a {
				border-radius: 30rpx;
				padding: 20rpx;
				color: #fff;
				background-color: #d9614c;
			}
			.rect_b {
				border-radius: 30rpx;
				padding: 30rpx;
				margin: 50rpx 0;
				color: #fff;
				background-color: #58c858;
			}
		}

	}
</style>
<style>
	@font-face {
		font-family: 'MyFont';
		src: url('@/static/fonts/LED.otf');
	}

	page {
		background-color: #f2f1f6;
	}
</style>